package cn.zhouyang.redistest.push;

import redis.clients.jedis.JedisPubSub;

/**
 * @Author:ZhouYang
 * @Description:
 * @Date: Created in 2021/3/23 9:42
 * @Modified By： Redis订阅者2
 */
public class Subscriber2 extends JedisPubSub {

    //接收消息调用
    @Override
    public void onMessage(String channel, String message) {
        System.out.println(String.format("订阅者2 接收到的Redis消息 %s, message %s", channel, message));
    }

    //订阅频道调用
    @Override
    public void onSubscribe(String channel, int subscribedChannels) {
        System.out.println(String.format("订阅者2订阅频道调用 %s, subscribedChannels %d",
                channel, subscribedChannels));
    }

    //取消订阅调用
    @Override
    public void onUnsubscribe(String channel, int subscribedChannels) {
        System.out.println(String.format("订阅者2取消订阅, channel %s, subscribedChannels %d",
                channel, subscribedChannels));
    }
}
